<template>
	<view>
		<!-- 预估收益 -->
		<view class="bg-white radius" v-for="(item, index) in list" :key="index">
			<view class="padding-tb-xs solids-bottom flex margin-lr-sm">
				<view class="basis-df flex align-center padding-left">
					<icon-font :type="iconType(item.platformType)" size="22" :color="iconColor(item.platformType)"></icon-font>
					<text class="padding-left-sm">{{ item.platformType | shopTypeText }}</text>
				</view>
				<view class="basis-df flex align-center">
					订单状态：
					<text class="text-green">{{ item.verifyStatus | statusText }}</text>
				</view>
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left one-line" v-if="showTitle">商品名称：{{ item.itemTitle }}</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left">付款时间：{{ item.tkCreateTime | formatDate }}</view>
			<view class="margin-sm padding-bottom-xs solids-bottom flex">
				<view class="basis-df padding-left">商品单价：{{ item.itemPrice | Fixed2 }}</view>
				<view class="basis-df">购买数量：{{ item.itemNum }}</view>
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom flex">
				<view class="basis-df padding-left">
					预估收益：
					<text class="text-bold text-pink">{{ item.estimationIncome | Fixed2 }}</text>
				</view>
				<view class="basis-df">实付金额：{{ item.alipayTotalPrice | Fixed2 }}</view>
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom flex" v-if="item.settleCurrency != 'CNY'">
				<view class="basis-df padding-left">
					结算币种：
					<text class="text-bold" :class="item.settleCurrency == 'CNY' ? 'text-rmb' : item.settleCurrency == 'BTC' ? 'text-btc' : 'text-eth'">
						{{ item.settleCurrency | CurrencyText }}
					</text>
				</view>
				<view class="basis-df">
					预估结算金额：
					<text class="text-bold" :class="item.settleCurrency == 'CNY' ? 'text-rmb' : item.settleCurrency == 'BTC' ? 'text-btc' : 'text-eth'">
						{{ item.settleAmount | AmountText }}
					</text>
				</view>
			</view>
			<view class="margin-sm padding-bottom-xs"></view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		list: {
			// 数据列表
			type: Array,
			default() {
				return [];
			}
		},
		showTitle: {
			type: Boolean,
			default: true
		}
	},
	methods: {
		iconType(type) {
			//商家图标类别
			return type == 'tb' ? 'taobao' : 'jingdong';
		},
		iconColor(type) {
			//商家图标颜色
			return type == 'tb' ? '#FF7D00' : '#F83716';
		},
	},
	filters: {
		shopTypeText: function(type) {
			//商家类别
			return type == 'tb' ? '淘宝' : type == 'jd' ? '京东' : '拼多多';
		},
		statusText: function(status) {
			//订单状态
			return status == 'valid' ? '有效' : '无效';
		},
		CurrencyText: function(currency) {
			//结算币种
			return currency == 'CNY' ? '人民币' : currency;
		},
		AmountText: function(amount) {
			//预估结算金额
			return amount ? amount : ' 结算中';
		}
	}
};
</script>

<style lang="scss">
.one-line {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	overflow: hidden;
}
</style>
